#include "Comm.hpp"

int main()
{
    Fifo fifo(Path);
    int wfd = open(Path, O_WRONLY);

    if (wfd < 0)
    {
        cerr << "open failed, error" << errno << ", errstring: " << strerror(errno) << endl;
        return 1;
    }

    string buffer;
    while(true)
    {
        cout<<"please enter your message#";
        std::getline(cin,buffer);
        if (buffer == "quit") break;
        ssize_t n = write(wfd,buffer.c_str(),buffer.size());
        if(n < 0)
        {   
            cerr << "write failed, errno: " << errno << ", errstring: " << strerror(errno) << endl;
            break;
        }

    }

    close(wfd);
    // cout << "hello"<<endl;
    return 0;
}